Skip to content

refactor: Dual path for rpc handlers - #3198

Merged
godexsoft merged 27 commits into
XRPLF:developfrom
godexsoft:refactor/consteval-specs-dual-path
Sep 9, 2026
Merged

godexsoft merged 27 commits into
XRPLF:developfrom
godexsoft:refactor/consteval-specs-dual-path

Conversation

@godexsoft

Copy link
Copy Markdown
Collaborator

Started from #3173

Adds a second dispatch path so handlers can use the shared rpc-spec (HandlerFor<Input>), plus the LedgerSpecifier → ledger-header helper they'll need — no handler migrates, nothing changes on the wire.

@codecov

codecov Bot commented Sep 1, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 86.66667% with 4 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/rpc/RPCHelpers.cpp 88.88% 1 Missing and 1 partial ⚠️
src/rpc/common/impl/Processors.hpp 83.33% 0 Missing and 2 partials ⚠️

📢 Thoughts on this report? Let us know!

@godexsoft
godexsoft changed the base branch from develop to refactor/consteval-specs-move-errors September 8, 2026 13:12
@godexsoft
godexsoft requested a review from a team as a code owner September 8, 2026 13:12
@godexsoft
godexsoft changed the base branch from refactor/consteval-specs-move-errors to refactor/consteval-specs-shared-leaf-util September 8, 2026 13:55

@mathbunnyru mathbunnyru left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see lots of unrelated changes here too

@godexsoft

Copy link
Copy Markdown
Collaborator Author

I see lots of unrelated changes here too

Yeah, idk how stacking works here.. seems like it does not. I would not look at this before we merge the previous PRs in the series.

@bthomee
bthomee requested a lite review from Copilot September 8, 2026 15:22

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

It changes core RPC dispatch semantics and error/warning plumbing across many modules and relies on external rpcspec behavior, so a human review plus CI confirmation is needed.

Pull request overview

This PR refactors RPC handler dispatch to support a second, typed-input path based on the shared xrpl-rpc-spec library (rpc::spec::HandlerFor<Input>), while keeping the existing “legacy” handler path intact. It also adds a helper for resolving spec::LedgerSpecifier into a ledger header, and updates Clio to consume error/warning types from rpcspec (including the updated “xrpld” wording), with no intended wire-level behavior changes beyond the already-noted warning text update.

Changes:

  • Add a typed handler dispatch path in rpc::impl::DefaultProcessor guarded by new concepts and a compile-time exclusivity check.
  • Introduce getLedgerHeaderFromLedgerSpecifier(...) to resolve spec-library LedgerSpecifier to a backend ledger header with Clio’s validated-ledger semantics.
  • Migrate many includes/usages from rpc/Errors.hpp to <rpcspec/Errors.hpp>, rename forwarding-related ClioError values, bump xrpl-rpc-spec to 0.1.7, and update pinned tooling/action revisions.
File summaries
File Description
tests/unit/web/RPCServerHandlerTests.cpp Switch to rpcspec errors; update clio warning message “rippled” → “xrpld”.
tests/unit/web/ng/RPCServerHandlerTests.cpp Switch to rpcspec errors include.
tests/unit/web/ng/impl/ErrorHandlingTests.cpp Switch to rpcspec errors include.
tests/unit/web/LoadWarningTests.cpp Switch to rpcspec errors include.
tests/unit/web/impl/ErrorHandlingTests.cpp Switch to rpcspec errors include.
tests/unit/rpc/RPCHelpersTests.cpp Add coverage for getLedgerHeaderFromLedgerSpecifier (hash/seq/shortcuts/assert cases).
tests/unit/rpc/RPCEngineTests.cpp Switch to rpcspec errors include.
tests/unit/rpc/handlers/VaultInfoTests.cpp Switch to rpcspec errors include.
tests/unit/rpc/handlers/UnsubscribeTests.cpp Switch to rpcspec errors include.
tests/unit/rpc/handlers/TxTests.cpp Switch to rpcspec errors include.
tests/unit/rpc/handlers/TestHandlerTests.cpp Switch to rpcspec errors include.
tests/unit/rpc/handlers/SubscribeTests.cpp Switch to rpcspec errors include.
tests/unit/rpc/handlers/ServerInfoTests.cpp Switch to rpcspec errors include; update renamed forwarding error enums in expectations.
tests/unit/rpc/handlers/LedgerTests.cpp Switch to rpcspec errors include.
tests/unit/rpc/handlers/LedgerEntryTests.cpp Switch to rpcspec errors include.
tests/unit/rpc/handlers/LedgerDataTests.cpp Switch to rpcspec errors include.
tests/unit/rpc/handlers/DefaultProcessorTests.cpp Add typed-path tests + static-asserts pinning which path each handler uses.
tests/unit/rpc/handlers/CredentialHelpersTests.cpp Switch to rpcspec errors include.
tests/unit/rpc/handlers/AccountOffersTests.cpp Switch to rpcspec errors include.
tests/unit/rpc/handlers/AccountLinesTests.cpp Switch to rpcspec errors include.
tests/unit/rpc/handlers/AccountInfoTests.cpp Switch to rpcspec errors include.
tests/unit/rpc/handlers/AccountCurrenciesTests.cpp Switch to rpcspec errors include.
tests/unit/rpc/ForwardingProxyTests.cpp Switch to rpcspec errors include; update renamed forwarding error enums in expectations.
tests/unit/rpc/ErrorTests.cpp Update warning text expectation; update renamed forwarding error enums.
tests/unit/rpc/common/TypesTests.cpp Remove rpc/Errors.hpp include (now via rpcspec where needed).
tests/unit/rpc/common/SpecsTests.cpp Switch to rpcspec errors include.
tests/unit/rpc/common/CheckersTests.cpp Switch to rpcspec errors include.
tests/unit/rpc/BaseTests.cpp Switch to rpcspec errors include.
tests/unit/etl/SourceImplTests.cpp Switch to rpcspec errors include; minor formatting.
tests/unit/etl/LoadBalancerTests.cpp Switch to rpcspec errors include; update renamed forwarding error enums in expectations.
tests/unit/etl/ForwardingSourceTests.cpp Switch to rpcspec errors include; update renamed forwarding error enums in expectations.
tests/unit/etl/ETLStateTests.cpp Switch to rpcspec errors include; update renamed forwarding error enums in expectations.
tests/unit/app/WebHandlersTests.cpp Switch to rpcspec errors include.
tests/integration/migration/cassandra/DBRawData.cpp Formatting-only adjustment of closing braces/indentation.
tests/common/util/MockSource.hpp Switch to rpcspec errors include.
tests/common/rpc/FakesAndMocks.hpp Add typed-input fake + ADL spec hook + typed handler fakes (HandlerFor-based).
tests/common/rpc/FakesAndMocks.cpp Add explicit HandlerFor<TypedInput> instantiation / defs include.
tests/common/CMakeLists.txt Add new rpc/FakesAndMocks.cpp to testing common library sources.
src/web/ng/impl/ErrorHandling.cpp Update forwarding ClioError enum names; include rpcspec errors.
src/web/impl/ErrorHandling.hpp Update forwarding ClioError enum names in switch.
src/web/CMakeLists.txt Link rpcspec::rpcspec into clio_web.
src/rpc/RPCHelpers.hpp Declare getLedgerHeaderFromLedgerSpecifier; include rpcspec/Ledger.hpp.
src/rpc/RPCHelpers.cpp Implement getLedgerHeaderFromLedgerSpecifier; switch to rpcspec errors/ledger includes.
src/rpc/handlers/VaultInfo.cpp Switch to rpcspec errors include.
src/rpc/handlers/Unsubscribe.cpp Switch to rpcspec errors include.
src/rpc/handlers/TransactionEntry.cpp Switch to rpcspec errors include.
src/rpc/handlers/Subscribe.cpp Switch to rpcspec errors include.
src/rpc/handlers/NoRippleCheck.cpp Switch to rpcspec errors include.
src/rpc/handlers/NFTsByIssuer.cpp Switch to rpcspec errors include.
src/rpc/handlers/NFTOffersCommon.cpp Switch to rpcspec errors include.
src/rpc/handlers/NFTInfo.cpp Switch to rpcspec errors include.
src/rpc/handlers/NFTHistory.cpp Switch to rpcspec errors include.
src/rpc/handlers/MPTokenIssuanceHistory.cpp Switch to rpcspec errors include.
src/rpc/handlers/MPTHolders.cpp Switch to rpcspec errors include.
src/rpc/handlers/LedgerIndex.cpp Switch to rpcspec errors include.
src/rpc/handlers/LedgerEntry.cpp Switch to rpcspec errors include.
src/rpc/handlers/LedgerData.cpp Switch to rpcspec errors include.
src/rpc/handlers/GetAggregatePrice.cpp Remove rpc/Errors.hpp include.
src/rpc/handlers/GatewayBalances.cpp Switch to rpcspec errors include.
src/rpc/handlers/Feature.cpp Switch to rpcspec errors include.
src/rpc/handlers/DepositAuthorized.cpp Switch to rpcspec errors include.
src/rpc/handlers/AMMInfo.cpp Switch to rpcspec errors include.
src/rpc/handlers/AccountTx.cpp Switch to rpcspec errors include.
src/rpc/handlers/AccountOffers.cpp Switch to rpcspec errors include.
src/rpc/handlers/AccountObjects.cpp Switch to rpcspec errors include.
src/rpc/handlers/AccountNFTs.cpp Switch to rpcspec errors include.
src/rpc/handlers/AccountMPTokens.cpp Switch to rpcspec errors include.
src/rpc/handlers/AccountMPTokenIssuances.cpp Switch to rpcspec errors include.
src/rpc/handlers/AccountLines.cpp Switch to rpcspec errors include.
src/rpc/handlers/AccountInfo.cpp Switch to rpcspec errors include; minor formatting.
src/rpc/handlers/AccountCurrencies.cpp Switch to rpcspec errors include.
src/rpc/handlers/AccountChannels.cpp Switch to rpcspec errors include.
src/rpc/Factories.cpp Switch to rpcspec errors include.
src/rpc/Errors.hpp Convert to rpcspec-backed error model (keep Clio-side info + JSON rendering declarations).
src/rpc/Errors.cpp Implement Status streaming + update error-info table + forwarding error enum renames.
src/rpc/CredentialHelpers.cpp Switch to rpcspec errors include.
src/rpc/common/Validators.cpp Switch to rpcspec errors include.
src/rpc/common/Specs.hpp Doc comment tweaks (remove @ref noise).
src/rpc/common/Specs.cpp Switch to rpcspec errors include.
src/rpc/common/MetaProcessors.cpp Switch to rpcspec errors include.
src/rpc/common/impl/Processors.hpp Add typed handler dispatch path + compile-time exclusivity guard + warnings JSON conversion.
src/rpc/common/Concepts.hpp Add SomeHandlerWithTypedInput + kIsSingleInputPath; update SomeHandler to include typed path.
src/rpc/common/AnyHandler.hpp Doc comment tweak (remove @ref noise).
src/feed/CMakeLists.txt Link rpcspec::rpcspec into clio_feed.
src/etl/Source.hpp Switch to rpcspec errors include.
src/etl/LoadBalancer.cpp Switch to rpcspec errors include; update forwarding error enum names.
src/etl/impl/SourceImpl.hpp Switch to rpcspec errors include.
src/etl/impl/ForwardingSource.hpp Switch to rpcspec errors include.
src/etl/impl/ForwardingSource.cpp Switch to rpcspec errors include; update forwarding error enum names.
src/etl/CMakeLists.txt Link rpcspec::rpcspec into clio_etl.
src/app/WebHandlers.cpp Include rpcspec errors.
conanfile.py Bump xrpl-rpc-spec dependency to 0.1.7.
conan.lock Update lockfile entry for xrpl-rpc-spec/0.1.7.
.pre-commit-config.yaml Bump pinned clang-format mirror + gersemi hook revisions.
.github/workflows/docs.yml Bump actions/deploy-pages pin to v5.0.1.
.github/actions/build-docker-image/action.yml Bump docker/setup-qemu-action pin to v4.3.0.
Review details
  • Files reviewed: 22/24 changed files
  • Comments generated: 0
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@godexsoft
godexsoft changed the base branch from refactor/consteval-specs-shared-leaf-util to develop September 8, 2026 16:24
Comment thread src/rpc/common/impl/Processors.hpp
Comment thread src/rpc/common/impl/Processors.hpp Outdated
Comment thread src/rpc/RPCHelpers.cpp
@godexsoft
godexsoft requested a review from bthomee September 9, 2026 11:47
bthomee
bthomee previously approved these changes Sep 9, 2026
Comment thread src/rpc/common/impl/Processors.hpp
mathbunnyru
mathbunnyru previously approved these changes Sep 9, 2026
Comment thread src/rpc/common/impl/Processors.hpp Outdated
Comment thread src/rpc/common/impl/Processors.hpp Outdated
Comment thread src/rpc/common/impl/Processors.hpp Outdated
Comment thread src/rpc/common/impl/Processors.hpp Outdated
Comment thread src/rpc/RPCHelpers.cpp Outdated
@godexsoft
godexsoft dismissed stale reviews from mathbunnyru and bthomee via 04c09f0 September 9, 2026 13:41
@godexsoft
godexsoft merged commit 81efb22 into XRPLF:develop Sep 9, 2026
31 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants